﻿@model PagedList<MessageModel>
@using MyBlog

@if (Model.Count == 0)
{
    <div class="dv-none-tip">暂无留言，坐个沙发吧~</div>
}
else
{
    int i = 1;
    foreach (var item in Model)
    {
        var cuser = WebCache.GetAccount(item.VisitUid);
        var j = Model.TotalItemCount + 1 - ((Model.CurrentPageIndex - 1) * 15 + (i++));
        <div class="dv-msg-com-begin" id="m-@item.ID">
            <div class="dv-msg-com-main">
                <div class="dv-msg-com-main-header">
                    <a href="@Url.Content("~/" + item.VisitUid)">
                        @if (cuser.HeadId.HasValue && cuser.HeadId.Value > 0)
                        {
                            <img src="@Url.Action("GetUserHeadByUid","account", new {uid= item.VisitUid })" />
                        }
                        else
                        {
                            <img src="~/Content/Images/zanwutouxiang.jpg" />
                        }
                    </a>
                </div>
                <div class="dv-msg-com-main-body">
                    <div class="dv-msg-com-main-body-header">
                        <span>
                            <span class="spfloor">#@(j)楼</span>
                            <span class="spuid">@cuser.NickName</span>
                            <span class="sptime">@item.MsgTime.ToString("yyyy-MM-dd HH:mm")</span>
                        </span><br />
                        <span class="spcontent ueditorContent">@Html.Raw(item.Content)</span>
                    </div>
                    <div class="dv-msg-com-main-body-footer">
                        <span>
                            <a href="javascript:;" onclick="goReply(@item.ID,'@cuser.NickName')"><i class="icon-reply"></i> 回复</a>
                        </span>
                        <span>
                            <a href="javascript:;" onclick="agree(@item.ID,@item.AgreeCount,this)"><i class="icon-heart"></i> 赞(@item.AgreeCount)</a>
                        </span>
                        @if (ViewBag.CanEdit)
                        {
                            <span>
                                <a href="javascript:;" onclick="delMsg(@item.ID)"><i class="icon-remove"></i> 删除</a>
                            </span>                   
                        }
                    </div>
                </div>
            </div>
            @if (item.MsgReplyModels.Count > 0)
            {
                Html.RenderPartial("_UserReplyList", new ViewDataDictionary { { "models", item.MsgReplyModels }, { "count", j }, { "CanEdit", ViewBag.CanEdit } });
            }
        </div>
    }
}
